const defaultStates = {
    Audiolyrics: '听见好时光', // 歌词
    AudioLyricsLine: -1, // 歌词选中行
    AudioIsPlay: false, // 是否播放
    historyList: [
        /*
        {
            id: xxxx,
            info: {},
        }
        * */
    ], // 历史播放列表
    historyListActive: null, // 历史播放列表选中
    LyricsList: null, // 歌词返回
    cookies: null, // token
    userInfo: null, // 登录后用户信息
    userId: null, // 登录后userid
    historyLength: 0, // 路由总长度
    activeLength: 0, // 在第几页
    historyActiveItem: null, // 当前播放详情
    PlayAudioType: 0, // 0 表示 顺序播放  1 - 随机播放 2 - 单曲循环 3 - 心动模式 4- 列表循环
    lastActiveAudio: [],
    IndexKey: 0, // 首页tab选中
};

export default (previousState = defaultStates, action) => {
    switch (action.type){
        case "SET_LYRICS":
            return Object.assign({},previousState,{
                Audiolyrics: action.value,
            })
        case "SET_HISTORYLIST":
            return Object.assign({},previousState,{
                historyList: action.value,
            })
        case "SET_HISTROYACTIVE":
            return Object.assign({},previousState,{
                historyListActive: action.value,
            })
        case "SET_USERINFO":
            return Object.assign({},previousState,{
                userInfo: action.value,
            })
        case "SET_COOKIES":
            return Object.assign({},previousState,{
                cookies: action.value,
            })
        case "SET_USERID":
            return Object.assign({},previousState,{
                userId: action.value,
            })
        case "SET_HISTORY":
            return Object.assign({},previousState,{
                historyLength: action.value,
            })
        case "SET_ACTIVEHISTORY":
            return Object.assign({},previousState,{
                activeLength: action.value,
            })
        case "SET_HISTORYLISTACTIVEITEM":
            return Object.assign({},previousState,{
                historyActiveItem: action.value,
            })
        case "SET_PLAYAUDIOTYPE":
            return Object.assign({},previousState,{
                PlayAudioType: action.value,
            })
        case "SET_LASTACTIVEAUDIO":
            return Object.assign({},previousState,{
                lastActiveAudio: action.value,
            })
        case "SET_LyricsList":
            return Object.assign({},previousState,{
                LyricsList: action.value,
            })
        case "SET_AudioLyricsLine":
            return Object.assign({},previousState,{
                AudioLyricsLine: action.value,
            })
        case "SET_ISAUDIOPLAY":
            return Object.assign({},previousState,{
                AudioIsPlay: action.value,
            })
        case "SET_INDEXKEY":
            return Object.assign({},previousState,{
                IndexKey: action.value,
            })
        default:
            return previousState;
    }
}